{% set pypi_name = 'python-saharaclient' %}
{% set upstream_version = upstream_version('3.3.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Epoch:          {{ epoch('python-saharaclient') }}
Summary:        Client library for OpenStack Sahara API
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('osc-lib') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.log') }}
BuildRequires:  {{ py3('oslo.serialization') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('requests') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testrepository') }}
BuildArch:      noarch

%description
Python client library for interacting with OpenStack Sahara API.

%package -n python3-saharaclient
Summary:        Client library for OpenStack Sahara API
Requires:       {{ py3('Babel') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('python-openstackclient') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}

%description -n python3-saharaclient
Python client library for interacting with OpenStack Sahara API.

This package contains the Python 3.x module.

%package -n python-saharaclient-doc
Summary:        Documentation for Client library for OpenStack Sahara API
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n python-saharaclient-doc
Python client library for interacting with OpenStack Sahara API.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

%install
%{py3_install}

# Build HTML docs and man page
PYTHONPATH=. PBR_VERSION={{ upstream_version }} %sphinx_build -b html -d doc/build/doctrees doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%check
# we don't want to depend on hacking/flake8/pep8
rm -v saharaclient/tests/unit/test_hacking.py
python3 -m stestr.cli run

%files -n python3-saharaclient
%license LICENSE
%doc ChangeLog README.rst
%{python3_sitelib}/saharaclient
%{python3_sitelib}/*.egg-info

%files -n python-saharaclient-doc
%doc doc/build/html
%license LICENSE

%changelog
